package com.smiletrain.util;

import com.smiletrain.R;
import com.smiletrain.activities.WellcomeActivity;
import com.smiletrain.activities.base.AbstractActivity;

import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;

public class AdminActivity {

	public static class BackOnClickListener implements OnClickListener {

		public BackOnClickListener(Activity activity) {
			this.activity = activity;
		}
		
		@Override
		public void onClick(View arg0) {
			activity.onBackPressed();
		}
		
		private Activity activity;
		
	}
	
	public static class HomeOnClickListener implements OnClickListener {

		public HomeOnClickListener(AbstractActivity activity) {
			this.activity = activity;
		}
		
		@Override
		public void onClick(View arg0) {
			
			activity.updateCaso();
			
			AdminCasos.instance.saveCasos();
			AdminCasos.instance.setCasoActual(null);
			Intent intent = new Intent(activity, WellcomeActivity.class);
			intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
			activity.startActivity(intent);
			activity.overridePendingTransition(R.anim.in_anim, R.anim.back_anim);
		}
		
		private AbstractActivity activity;
		
	}
	
}
